<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
	String loginType="admin";
	if(loginType.equals("admin")){
	 out.println("<script type='text/javascript'> function ShowType(){document.getElementById('type').innerHTML = 'admin' } </script>");
	}else{
		out.println("<script type='text/javascript'> function ShowType{ document.getElementById('type').innerHTML = 'admin' } </script>");
	}
%>

<input type="button" value="0查看服务端代码传来的js函数" onclick="ShowType();"><br>
<a href="Servlet1">1查看导向Servlet1后，out.print()，可以成功，但页面地址是Servlet1</a><br>
<a href="Servlet2">2查看导向Servlet2后，out.print()加上getRequestDispatcher。out.print()无效，但页面地址不是getRequestDispatcher中地址，而是Servlet2</a><br>
<a href="Servlet3">3查看导向Servlet3后，out.print()加上sendRedirect。out.print()无效，但页面地址是sendRedirect中的地址</a><br>
<div id="type">aa</div>
</body>
</html>